package com.zxl.yjb.activity.my;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.zxl.yjb.R;
import com.zxl.yjb.base.BaseActivity;

public class UpdataSignatureAcitivity extends BaseActivity {

    private String oldSignature;
    private EditText etSignature;
    private ImageView ivBack;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_updata_signature);
        oldSignature = getIntent().getStringExtra("old_signature");
        initView();
        initEvent();
    }
    @Override
    protected void initView() {
        etSignature = findViewById(R.id.et_signature);
        TextView tvTile = findViewById(R.id.tv_page_title);
        ivBack = findViewById(R.id.iv_back);
        tvTile.setText(R.string.updata_signature);
        etSignature.setText(oldSignature);

    }

    private void initEvent() {
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String newSignature = etSignature.getText().toString().toString();
                if (!TextUtils.isEmpty(newSignature)) {
                    setResult(RESULT_OK,new Intent().putExtra("new_signature",newSignature));
                }
                finish();
            }
        });
    }


}
